<script>
$(document).ready(function() {
	<?php
	if ($updated == 1) echo 'showNoti("Mô đun: '.$name.'", "Thêm mới mô đun thành công!", "Ok");';
    if ($failed == 1) echo 'showNoti("Mô đun: '.$name.'", "Cập nhập mô đun thất bại!", "Err");';
	if ($GLOBALS['var']['deleted'] != 1) echo 'makeDragOrder("'.$GLOBALS['var']['act'].'");';
	?>
});
</script>
<?php echo module_open(); ?>
<tr class="no-border">
    <td>
        <input type="hidden" id="modules_groups" class="tabId" value="<?php echo $GLOBALS['var']['mytab'] ?>" />
        <ul id="myTab" class="nav nav-tabs">
            <?php
            for ($i = 0; $i < count($GLOBALS['modules_groups']); $i++)
            {
        		if ($GLOBALS['modules_groups'][$i]['enable'] && count($tab_modules[$i]) > 0)
                {
                    echo '<li class="hide640'.($i == $GLOBALS['var']['mytab'] ? ' active' : '').'" onclick="set_mytab($(this))"><a href="#tabs-'.$i.'" data-toggle="tab">'.$GLOBALS['modules_groups'][$i]['name'].'</a></li>';
                }
            }
            unset($i);
            ?>
            <li class="dropdown active show640">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="current-tab-name"><?php echo $GLOBALS['modules_groups'][$GLOBALS['var']['mytab']]['name'] ?></span> <span class="caret"></span></a>
                <ul class="dropdown-menu">
                <?php
                for($i = 0; $i < count($GLOBALS['modules_groups']); $i++)
                {
                    if ($GLOBALS['modules_groups'][$i]['enable'])
                    {
                        echo '<li'.($i == $GLOBALS['var']['mytab'] ? ' class="active"' : '').' onclick="set_mytab($(this))"><a href="#tabs-'.$i.'" data-toggle="tab">'.$GLOBALS['modules_groups'][$i]['name'].'</a></li>';
                    }
                }
                ?>
                </ul>
            </li>
        </ul>
        <div id="myTabContent" class="tab-content">
        <?php
        for ($t = 0; $t < count($GLOBALS['modules_groups']); $t++)
        {
            if ($GLOBALS['modules_groups'][$t]['enable'] && count($tab_modules[$t]) > 0)
            {
        ?>
            <div id="tabs-<?php echo $t ?>" class="tab-pane<?php echo ($t == $GLOBALS['var']['mytab'] ? ' active" ' : '') ?>">
            <table cellpadding="0" cellspacing="0" width="100%" border="0">
                <tr class="nodrop">
                    <?php if ($GLOBALS['cfg']['develop_mode'] && $GLOBALS['per']['del']) echo '<td class="head center" width="1%"><input type="checkbox" class="checkAll" /></td>'; ?>
                	<td class='head center' width='2%'>#</td>
                	<td class='head' width='30%'>Mô đun</td>
                	<?php if ($GLOBALS['cfg']['develop_mode']) echo '<td class="head hide640" width="30%">Source php</td>'; ?>
                	<td class='head center hide480' width='15%'>Biểu tượng</td>
                	<td class='head center hide480' width='10%'>Menu</td>
                	<td class='head center hide480' width='10%'>Kích hoạt</td>
                	<td class="head center" width="1%">&nbsp;</td>	
            	</tr>
                <?php
                if (count($tab_modules[$t]) && is_array($tab_modules[$t]))
                {
                    $n = 1;
                    foreach ($tab_modules[$t] as $row)
                    {
                ?>
                <tr class="highlight<?php echo ($row['isnew'] ? ' table-flag-red' : '') ?>" id="<?php echo $row['id'] ?>" name="<?php echo $row['name_vn'] ?>">
                    <?php
                    if ($GLOBALS['cfg']['develop_mode'] && $GLOBALS['per']['del'])
                    {
                        echo '<td class="fr center" width="1%">'.sel_item($row['id']).'</td>';
                    }
                    ?>
                    <td class="fr center"><?php echo stt($row['id'], $n++) ?></td>
                    <td class="fr"><?php echo $row['name_vn'] ?></td>
                    <?php
                    if ($GLOBALS['cfg']['develop_mode'])
                    {
                        echo '<td class="fr hide640">./application/controllers/'.$row['file'].'.php</td>';
                    }
                    ?>
                    <td class="fr center hide480"><?php echo show_img('img/modules/'.$row['image'], '', 
                    'max-height: 24px') ?></td>
                    <td class="fr center hide480"><?php echo change_status($row['id'], $row['menu'], 'menu', '', '', '', !$GLOBALS['per']['edit']) ?></td>
                    <td class="fr center hide480"><?php echo change_status($row['id'], $row['active'], 'active', '', '', '', !$GLOBALS['per']['edit']) ?></td>
                    <td class="fr center" nowrap="nowrap">
                        <?php if ($GLOBALS['per']['edit']) echo edit_alink('', $url_update.'/'.$row['id'].$uri_str); ?>
                        <?php if ($GLOBALS['cfg']['develop_mode'] && $GLOBALS['per']['del']) echo del_restore_link($row['id'], $row['deleted']); ?>
                    </td>
                </tr>
                <?php
                    }
                }
                else
                {
                    echo no_data_mes($GLOBALS['cfg']['develop_mode'] ? 8 : 5);
                }
                ?>
            </table>
         </div>
        <?php
            }
        }
        ?>
        </div>
    </td>
</tr>
<?php echo module_close(); ?>